<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User_car extends MY_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('User_car_model');
	}
	//查询列表
	public function index()
	{

		$username = $this->input->get_post('username');
		$carno = $this->input->get_post('carno');
		$start =  intval($this->input->get_post('per_page'));
 
		$params = array(
			'username' =>$username 
			,'carno' =>$carno 
			,'start' => $start
			,'length'=>$this->page_size);


		$result = $this->User_car_model->select_page($params);
		
		$result['params'] = $params;

		//分页设置
		$base_url = site_url("c=user_car&m=index&username=$username&carno=$carno");
		$result['pagelink'] = $this->create_page_links($base_url,$result['count']);

		$this->show_view('userCarList',$result);
	}

	 
	//删除用户
	public function delete()
	{
		$id = $this->input->get_post('id');
		$result = $this->User_car_model->delete($id);
		if($result['success'])
		{
			$this->show_message("删除车辆类型信息成功",site_url("c=user_car&m=index"));
		}
		else
		{
			$this->show_message($result['message'],site_url("c=user_car&m=index"));
		}
	}

	//新增用户
	public function map()
	{
		
		$this->show_view('userCarMap',$result);
		
	}

 
}